package com.oss.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

/**
 * 用户状态枚举
 * @author chengqiang
 */
@Getter
public enum UserStatusEnum {
    enable(1,"启用"),
    disenabled(2,"冻结"),
    delete(3,"删除");
    @EnumValue
    private final Integer key;
    private final String desc;
    UserStatusEnum(Integer key, String desc){
        this.key=key;
        this.desc=desc;
    }

    /**
     * 根据key获取枚举值
     * @param key 入参
     * @return 返回值
     */
    public static String getStatusEnumsDescByKey(Integer key){
        for (UserStatusEnum item : UserStatusEnum.values()) {
            if (item.getKey() == key) {
                return item.getDesc();
            }
        }
        return null;
    }
}
